self.onmessage = function (e) {
    const file = e.data;
    const reader = new FileReader();
  
    reader.onload = () => {
      self.postMessage({ success: true, base64: reader.result });
    };
  
    reader.onerror = (err) => {
      self.postMessage({ success: false, error: err.message });
    };
  
    reader.readAsDataURL(file);
  };
  
